package com.jiazhong.basic.shuxin.design.代理模式.动态代理模式;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Arrays;

public class DynamicProxyHandler implements InvocationHandler {

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("开始执行动态代理的操作");
        System.out.println("执行的方法是：" + method.getName());
        System.out.println("传递的参数是：" + Arrays.toString(args));
        // Object result = method.invoke(proxy, args);

        System.out.println("执行完毕" + method.getName() + "方法");
        if(method.getName().equals("save")){
            return null;
        }else {
            return "李四";
        }

    }
}
